home *** CD-ROM | disk | FTP | other *** search
- Path: news.iadfw.net!usenet
- From: Mark Nelson <markn@airmail.net>
- Newsgroups: comp.lang.c++
- Subject: Re: calloc() - is there a C++ equivalent ?
- Date: Tue, 19 Mar 1996 22:04:21 -0600
- Organization: customer of Internet America
- Message-ID: <314F83C5.8AC@airmail.net>
- References: <4inkp1$je5@ncar.ucar.edu>
- NNTP-Posting-Host: dal32-09.ppp.iadfw.net
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0GoldB1 (Win95; I)
-
- James Adams wrote:
- >
- > Hello,
- >
- > The subject line says it all - I want to allocate a block of
- > memory which I can count on being initialized to zero, as the calloc()
- > call in C will return. Is there such a beast in C++, or will I have to
- > do the initialization programmatically ?
- >
-
- You will have to do the initialization programmatically. If what you
- really need is just a block of raw memory initialized to zero, you
- probably are safe using calloc(). About the only thing that could
- potentially cause a problem is if you used calloc() to allocate the
- memory and then tried to use delete to free it. Even that stands
- a pretty good chance of working okay given today's compilers.
-
- Use calloc()/free() in your C++ program and you should be okay.
-
- Mark Nelson
- http://web2.airmail.net/markn
-